Description
The RemoveAt
method is used to remove an element at a specified index from the NetList<T>
. This method is sealed, meaning it cannot be overridden in derived classes. It is a virtual method, allowing it to be called on instances of derived classes.
Usage
To use the RemoveAt
method, you need to specify the zero-based index of the element you want to remove from the NetList<T>
. Ensure that the index is within the bounds of the list to avoid exceptions.
Example
// Example of using RemoveAt method
public class MyComponent : Component
{
[Sync] public NetList<int> MyIntegerList { get; set; } = new();
public void RemoveNumberAt(int index)
{
if (IsProxy) return;
if (index >= 0 && index < MyIntegerList.Count)
{
MyIntegerList.RemoveAt(index);
}
}
}